// 真实API接口配置
export const API_ENDPOINTS = {
  // 新闻资讯API
  NEWS: {
    TECH: "https://newsapi.org/v2/everything?q=technology&language=zh",
    FINANCE: "https://newsapi.org/v2/everything?q=finance&language=zh",
    BUSINESS: "https://newsapi.org/v2/everything?q=business&language=zh",
  },

  // 股市数据API
  STOCK: {
    CN_INDICES: "https://api.finance.yahoo.com/v1/finance/quote?symbols=000001.SS,399001.SZ",
    US_INDICES: "https://api.finance.yahoo.com/v1/finance/quote?symbols=^IXIC,^GSPC",
  },

  // 融资数据API
  FUNDING: {
    CRUNCHBASE: "https://api.crunchbase.com/v4/searches/funding_rounds",
    ITJUZI: "https://api.itjuzi.com/api/investment",
  },

  // 政策数据API
  POLICY: {
    GOV_CN: "http://www.gov.cn/zhengce/xxgk/",
    NDRC: "https://www.ndrc.gov.cn/fzggw/jgsj/",
  },
}

// API调用函数
export async function fetchNewsData(category: string) {
  // 实际项目中这里会调用真实API
  return fetch(API_ENDPOINTS.NEWS[category.toUpperCase()])
    .then((response) => response.json())
    .catch((error) => console.error("API调用失败:", error))
}

export async function fetchStockData() {
  // 调用股市数据API
  return fetch(API_ENDPOINTS.STOCK.CN_INDICES)
    .then((response) => response.json())
    .catch((error) => console.error("股市数据获取失败:", error))
}

export async function fetchFundingData() {
  // 调用融资数据API
  return fetch(API_ENDPOINTS.FUNDING.CRUNCHBASE)
    .then((response) => response.json())
    .catch((error) => console.error("融资数据获取失败:", error))
}
